/*
 * console.h
 *
 *  Created on: Aug 22, 2009
 *      Author: matt
 */

#ifndef CONSOLE_H_
#define CONSOLE_H_

#define NKEYS 256

#include <vector>
#include "constants.h"
#include "windows.h"
#include <string.h>
#include <string>
#include <ctime>
#include "simulator.h"
//#include "robot.h"

class CONSOLE
{
private:
#define KEYPRESS_MINWAIT 200
	std::vector<std::string> textlines;
	unsigned int ntextlines;
	unsigned int maxtextlines;
	bool const * keys;
	char buff[500];
	clock_t last_input_times[256];//NCONSOLE_INPUTS];
	clock_t last_enter_input;
	clock_t last_backspace_input;
//	ROBOT * robot;
	SIMULATOR * sim;
	void ProccessCommand(const char * command);
public:
	CONSOLE();
	CONSOLE(bool const * keys, SIMULATOR *sim, unsigned int = 10);
	void PushBackLine(char* const text);
	void GetConsoleLines(std::vector<std::string> &);
	void GetConsoleBuffer(char * &buff);
	void RunConsole();
	virtual ~CONSOLE();
};

#endif /* CONSOLE_H_ */
